package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * @description: 根据菜品ids查询套餐ids
     * @author: zhouzhijie
     * @date: 2023/11/15 15:03
     * @param:
     * @return:
     **/
    //select setmeal_id from setmeal_dish where dish_id in (1,2,3)
    List<Long> getSetmealByDishId(List<Long> dishIds);

    /**
     * @description: 批量保存套餐和菜品的关系
     * @author: zhouzhijie
     * @date: 2023/11/17 11:20
     * @param: [setmealDishes]
     * @return:
     **/
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * @description: 根据套餐ids批量删除套餐菜品关系表数据
     * @author: zhouzhijie
     * @date: 2023/11/17 15:23
     * @param: [ids]
     * @return:
     **/
    void deleteBatchByIds(List<Long> setmealIds);

    /**
     * @description: 根据套餐id查询套餐菜品关系表数据
     * @author: zhouzhijie
     * @date: 2023/11/18 15:54
     * @param: [id]
     * @return:
     **/
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealhId(Long setmealId);

    /**
     * @description: 根据套餐id删除套餐菜品关系表数据
     * @author: zhouzhijie
     * @date: 2023/11/18 16:45
     * @param: [setmealId]
     * @return:
     **/
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);
}
